package com.prs.crm.service.oa.impl;

import java.io.File;
import java.util.Collection;

import com.prs.crm.context.Attach;
import com.prs.crm.context.Constrains;
import com.prs.crm.context.FileUtil;
import com.prs.crm.dao.oa.OaTaskAuditDao;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.oa.OaTaskAudit;
import com.prs.crm.service.impl.BaseServiceImpl;
import com.prs.crm.service.oa.OaTaskAuditService;

public class OaTaskAuditServiceImpl extends BaseServiceImpl<OaTaskAudit,OaTaskAuditDao> implements OaTaskAuditService{

	@Override
	public void saveOaTaskAudit(OaTaskAudit oaTaskAudit, File file,
			String fileName) {
		// TODO Auto-generated method stub
		Attach attach = FileUtil.getInstance().saveFile(file, fileName, "", Constrains.UPLOAD_DIR_TASK);
		if(attach.getSrc() != null) {
			oaTaskAudit.setAttach(attach.getSrc());
		}
		this.getDao().save(oaTaskAudit);
	}

	@Override
	public Collection<OaTaskAudit> getOaTaskAudit2Person(Person person) {
		// TODO Auto-generated method stub
		return this.getDao().getOaTaskAudit2Person(person);
	}

}
